#include "Game.h"


#include "../application/GameAppImpl.h"
#include "Scene/SceneTest.h"

extern GameAppImpl*	g_pApp;

Game::Game()
	:m_pCurrScene(NULL)
{
	g_pApp->SetUpdateRenderFuncPtr(Update,Render);

	
	m_pCurrScene = new SceneTest();	//	should get from pool ,but not new here
}

Game::~Game()
{
	if( m_pCurrScene != NULL )
	{
		delete m_pCurrScene;
		m_pCurrScene = NULL;
	}
}


void Game::Update(float dt)
{
	GameInstance->DoUpdate(dt);
}

void Game::Render()
{
	GameInstance->DoRender();

}

void Game::DoUpdate(float dt)
{
	if( m_pCurrScene != NULL )
	{
		m_pCurrScene->Update(dt);
	}
}




void Game::DoRender()
{
	if( m_pCurrScene != NULL )
	{
		m_pCurrScene->Render();
	}

}